package org.cttic.visualization.visualization.util;

import org.cttic.visualization.visualization.common.T_mysqlData;
import org.cttic.visualization.visualization.common.sectionBillQuery;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;

import java.util.List;

/**
 * @author shkstart
 * @create 2020-04-29 10:50
 */
public class toSectionQueryUtil {
    @Autowired
    JdbcTemplate jdbcTemplate;

    public  String sectionQuery(String vehicleId,int vehicleIdColor,String transTime,String gantryId){
//        sectionBillQuery sectionBillQuery = new sectionBillQuery();
//        sectionBillQuery.setVehPlate(vehicleId);
//        sectionBillQuery.setPlateColor(vehicleIdColor);
//        sectionBillQuery.setCurrentsTime(transTime);
//
//
//        //查询mysql 门架基础信息表 T_GANTRY_MOUNTING
//        String sql ="SELECT gantryId,provinceId,tollIntervals,roadSectionId FROM `T_GANTRY_MOUNTING` \n" +
//                "where\tgantryId=\n"+
//                gantryId;
//        List<T_mysqlData> mysqlData = jdbcTemplate.query(sql, new BeanPropertyRowMapper<T_mysqlData>());
//        T_mysqlData t_mysqlData = mysqlData.get(0);
//        //G000444001001010040
//        sectionBillQuery.setSectionDirection(gantryId.substring(14, 15));
//
//        sectionBillQuery.setAdminCode(t_mysqlData.getProvinceId());        //省域编码
//        sectionBillQuery.setSectionCode(t_mysqlData.getRoadSectionId());       //路段编号
//        String tollIntervals = t_mysqlData.getTollIntervals();
//        sectionBillQuery.setTollIntervals(tollIntervals);      //路段单元编码
//        if(tollIntervals.contains("|")){
//            String[] splitData = tollIntervals.split("|");
//            int billMile = 0;   //单位米
//            for(int i=0;i<=splitData.length;i++){
//                billMile=billMile+Integer.parseInt(splitData[i]);
//            }
//            //单位 km
//            sectionBillQuery.setBillMile((float)billMile/1000);            //里程数
//        }
//        sectionBillQuery.setVehCode(1);              //计费车型
//        sectionBillQuery.setActualAxleNum(1);       //实际轴数
//
//        sectionBillQuery.setMediumType("1");         //通行介质类型



        return null;
    }
}
